package com.tensquare.qa.dao;

import com.tensquare.qa.pojo.Problem;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by WF on 2020/12/15 15:59
 */
public interface ProblemDao extends JpaRepository<Problem,String> {

    //1.最新问题列表
    @Query(nativeQuery=true,
            value="select p.* from tb_pl pl,tb_problem p where p.id=problemid and p.id=?1 order by createtime desc")
    List<Problem> findnewList(Integer labelId, Pageable pageable);

    //2.查询热门问题列表
    @Query(nativeQuery=true,value="select p.* from tb_pl pl,tb_problem p where p.id=problemid and p.id=?1 order by reply desc")
    List<Problem> findhotList(Integer labelId, Pageable pageable);
}
